package com.sg.business.commons.labelprovider.work;

import com.mobnut.commons.util.file.FileUtil;
import com.mobnut.db.model.PrimaryObject;
import com.sg.business.commons.labelprovider.linestyle.LineStyleHtmlLabel;
import com.sg.business.model.Work;
import com.sg.business.resource.BusinessResource;

public class NoteHtmlLabel extends LineStyleHtmlLabel {

	@Override
	public String getHtmlText(PrimaryObject work) {
		Object mark = work.getValue(Work.F_NOTE);
		String selectbarUrl = mark == null || mark.equals("") ? null : FileUtil
				.getImageURL(BusinessResource.IMAGE_NOTE_24,
						BusinessResource.PLUGIN_ID,
						BusinessResource.IMAGE_FOLDER);

		StringBuffer sb = new StringBuffer();
		if (selectbarUrl != null) {
			String selectbar = "<img src='" //$NON-NLS-1$
					+ selectbarUrl
					+ "' style='border-style:none;position:absolute; left:0; top:4; display:block;' width='16' height='16' />"; //$NON-NLS-1$
			sb.append(selectbar);
		}

		return sb.toString();
	}

}
